package org.xuyuji.web.data;

import java.util.ArrayList;
import java.util.List;

import org.xuyuji.web.dto.User;

public class UserData {
	private static List<User> list = new ArrayList<User>();
	
	static{
		list.add(new User(1, "张三", "123"));
		list.add(new User(2, "李四", "1234"));
		list.add(new User(3, "王五", "12345"));
	}
	
	public static User findUser(String username, String password){
		User user = null;
		
		for(User u : list){
			if(username != null && username.equals(u.getUsername()) 
				&& password != null && password.equals(u.getPassword())){
				user = u;
				break;
			}
		}
		
		return user;
	}
}
